function Alertify(opts) {
    this.init(opts);
}
Alertify.prototype.init = function(opts) {
	var me = this;
	var template = __inline("./alertify.tmpl");
    var content = template({});
    $(document.body).append(content);
    if(opts) {
        if(opts.showButton == false) {
            $('#alertify_commit').hide();
        }
        if(opts.showTitle == false) {
            $('#alertify .title').hide();   
        }
    }
    me._buttonEvent = function () {
        $('#alertify').modalBox('close');
    }
};
Alertify.prototype.show = function(opts) {
    var me = this;
    if(opts) {
        $('#alertify').css(opts);    
    }
	$('#alertify').modalBox({
        keyClose:true,
        bodyClose:true
    });
    $('#alertify_commit,.close_btn').click(me._buttonEvent);
}
Alertify.prototype.setMessage = function(error_message) {
    $('#alertify .info').html(error_message);
    this.show();
};
Alertify.prototype.setTitle = function(title) {
    $('#alertify .title').text(title);
    this.show();
};
Alertify.prototype.setButtonEvent = function(func) {
    var me = this;
    if(func){
        me._buttonEvent = func;
    }
}
Alertify.prototype.setButton = function(message) {
    $('#alertify_commit').text(message);
}
module.exports = Alertify;